package edu.scdx.dao;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


import edu.scdx.entity.UserInfo;

@Repository
public interface UserInfoMapper {

	@Select("insert into userinfo(tel,name) values(#{tel},#{name})")
	public void insertInfo(@Param("tel")String userTel, @Param("name") String userName);

	@Select("select * from userinfo where tel=#{tel}")
	public UserInfo getUserInfo(@Param("tel")String userTel);

	@Select("update userinfo set name=#{name},sex=#{sex},birthday=#{birthday} where tel=#{tel}")
	public void updateUserInfo(@Param("tel")String userTel, @Param("name")String userName, @Param("sex")String userSex, @Param("birthday")String userBirthday);
	
	@Select("update userinfo set money=money+#{money} where tel=#{tel}")
	public void updateUserMoney(@Param("tel")String userTel, @Param("money")int userMoney);

	@Select("update userinfo set money=money-#{money},rank=rank+#{rank} where tel=#{tel}")
	public void updateMoney(@Param("tel")String userTel,@Param("money") double price,@Param("rank") int rankAdd);

	@Select("update userinfo set score=score+#{score} where tel=#{tel}")
	public void updateScore(@Param("tel")String userTel,@Param("score") Integer jifen);

	
	
}
